package com.bw.yk.jtp.app.udf;

import ch.hsr.geohash.GeoHash;
import org.apache.hadoop.hive.ql.exec.UDF;

public class ConvertGeoHash extends UDF {
    public String evaluate(double latitude, double longitude, int num){
        GeoHash geoHash = GeoHash.withCharacterPrecision(latitude,longitude,num);
        return geoHash.toBase32();

    }


    public static void main(String[] args) {
        ConvertGeoHash geohashh = new ConvertGeoHash();
        String evaluate = geohashh.evaluate(39.92998577808024, 116.39564503787867, 6);
        System.out.println(evaluate);
    }
}
